package zdyu.users;


import org.junit.jupiter.api.Test;

import java.util.Random;
import java.util.stream.IntStream;


class FirstFuckingSolutionTest {

    Requirements solution = new FirstFuckingSolution();
    Random random = new Random();

    @Test
    void register() {
        IntStream.range(0, 10).forEach(i -> {
            String
                    username = Double.valueOf(random.nextDouble()).toString(),
                    passphrase = Double.valueOf(random.nextDouble()).toString();
            System.out.print (solution.register(username, passphrase));
            System.out.println(username + " " + passphrase);
        });

        String
                username = Double.valueOf(random.nextDouble()).toString(),
                passphrase = Double.valueOf(random.nextDouble()).toString();
        System.out.print(solution.register(username, passphrase));
        System.out.println(username + " " + passphrase);
        System.out.print(solution.register(username, passphrase));
        System.out.println(username + " " + passphrase);
    }

    @Test
    void login() throws Exception {
        System.out.println(solution.login("user", "pass"));
        System.out.println(solution.login("user", ""));
        System.out.println(solution.login("", ""));
    }

    @Test
    void changePassphrase() {
        System.out.println(solution.changePassphrase("", "", ""));
        System.out.println(solution.changePassphrase("user", "", ""));
        System.out.println(solution.changePassphrase("user", "pass", "fuck"));
        System.out.println(solution.changePassphrase("user", "pass", "pass"));
        System.out.println(solution.changePassphrase("user", "fuck", "pass"));
    }
}